import request from '@/utils/request'
import downloadRequest from '@/utils/downloadRequest'

// 登录系统
export function login(data) {
  return request({
    url: '/airborne/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getInfo(token) {
  return request({
    url: '/user/get_user_info',
    method: 'post',
    params: { token }
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/airborne/logout',
    method: 'post'
  })
}

// 查询列表数据
export function load(data) {
  return request({
    url: '/user/load_user',
    method: 'post',
    data
  })
}

// 查询组织下拉列表
export function findOrganization(data) {
  return request({
    url: '/user/load_all_son_organization',
    method: 'post'
  })
}

// 新增数据
export function add(data) {
  return request({
    url: '/airborne/register',
    method: 'post',
    data
  })
}

// 修改数据
export function update(data) {
  return request({
    url: '/user/edit',
    method: 'post',
    data
  })
}

// 导出excel
export function downExcel(data) {
  return downloadRequest({
    url: '/user/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}
